<?php


namespace App\Models\Field;

use App\Common\Libs\ArrayHelper;

class SalonField extends BaseField
{
    public static function getFormats($scene = self::BASE_INFO): array
    {
        $baseFormats = [
            'id' => static function ($model) {
                return $model['salon_id'];
            },
            'cover_url',
            'title',
            'address',
            'video',
            'description',
            'status' => static function ($model) {
                return service()->SalonService->getStatusByTime($model->start_at, $model->end_at, $model->is_review);
            },
            'is_enable',
            'is_review',
            'start_at',
            'end_at',
            'created_at',
        ];

        $formats = [
            self::SELF_DETAIL => ArrayHelper::merge($baseFormats, [
                'user_description',
                'lng',
                'lat',
            ]),
        ];

        return $formats[$scene] ?? $baseFormats;
    }
}
